import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Scale;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolTip;

/**
*
* Bachelor thesis at the Institute of Biomedical Engineering, 
* located at the UMIT/EWZ campus in Hall in Tyrol. <br><br>
*
* Class to create and keep all GUI Elements. Convinience class for the
* GUI-Elements to be available from everywhere
* 
* @author Stefan Fuchs
*
*/
public class GUIPluginMain {

	// GUI-Components
	
	/////////////////////
	public TabFolder tabFolder;
	public TabItem segItem;
	public TabItem heartItem;
	public TabItem electricalItem;
	public Group segGroup;
	public Group myocardiumGroup;
	public Group conductorGroup;
	
	/////Segmentation Group////////
	public Text openedImageText;
	public Button markBorderButton;
	public Button markROIButton;
	public Spinner pencilSizeSpinner;
	public Composite spinnerComp;
	public Button selectSlicesButton;
	public Spinner fromSpinner;
	public Spinner toSpinner;
	public Combo neighborhoodCombo;
	public Combo maxGreyValueCombo;
	public Combo distanceCombo;
	public Scale strengthScale;
	public Scale performanceScale;
	public Label strengthLabel;
	public Button resetButton;
	public Button segmentationButton;
	public Button saveButton;
	public ToolTip toolTip;
	
	//Heart Group
	public Group openCloseGroup;
	public Group rollingBallGroup;
	public Group manualASFCorrectionGroup;
	public Group manualrollingBallCorrectionGroup;	
		//Open-Close Group
	public Button openCloseButton;
	public Button closeOpenButton;
	public Spinner asfSpinner;
	public Button asfStartButton;
	public Label asfLabel;
	
		//Manual of Correction Group Group
	public Button manualASFCorrectDeleteButton;
	public Button manualASFCorrectAddButton;
	public Button manualASFCorrectStartButton;
	
		//Rolling-Ball Group
	public Group rollingBallColorOneGroup;
	public Group rollingBallColorTwoGroup;
	public Group rollingBallGrayValueRangeGroup;
	public Label colorOneLabel;
	public Label colorTwoLabel;
	public Spinner avgColorOneSpinner;
	public Spinner minColorOneSpinner;
	public Spinner maxColorOneSpinner;
	public Spinner avgColorTwoSpinner;
	public Spinner minColorTwoSpinner;
	public Spinner maxColorTwoSpinner;
	public Button rollingBallStartButton; 
	public Button rollingBallSaveButton;
	public Text minGrayValueText;
	public Text maxGrayValueText;
	
	public Spinner rollingBallZSliceSpinner;
	
		//Manual Correction of Rolling Ball Group
	
	public Button manualRollingBallCorrectDeleteButton;
	public Button manualRollingBallCorrectAddButton;
	public Button manualRollingBallCorrectStartButton;
	
	
	//Electrical Modell Group
	
	public Button loadBinaryImageButton; 
	public Button conductorDrawAVNodeButton;
	public Button conductorStartDrawing;
	
	/**
	 * This method initializes the gui components
	 * 
	 * @param shell
	 */
	public void initGUI(Shell shell) {

		// Some components used
		Composite tmpComp;
		GridLayout layout;
		FillLayout fillLayout;
		GridData gridData;
		FontData fontData;
		Label label;

		// /////////////////

		int desktopHeight = Display.getCurrent().getClientArea().height;
		int desktopWidth = Display.getCurrent().getClientArea().width;

		// Configuration of the shell
		shell.setSize(420, 500);
		shell.setLocation(desktopWidth / 20, desktopHeight / 20);
		shell.setText("HeartCell Segmentation & Generation");
		fillLayout = new FillLayout();
		fillLayout.marginHeight = 10;
		fillLayout.marginWidth = 10;
		shell.setLayout(fillLayout);

		// Tabfolder
		tabFolder = new TabFolder(shell,SWT.BORDER);
		
		segItem = new TabItem(tabFolder,SWT.NONE);
		segItem.setText("Segmentation");
		
		heartItem = new TabItem(tabFolder, SWT.NONE);
		heartItem.setText("Heart");
		
		electricalItem = new TabItem(tabFolder, SWT.NONE);
		electricalItem.setText("Conductor");
		
		// GUI-elements
		segGroup = new Group(tabFolder, SWT.SHADOW_IN);
		segGroup.setText("Segmentation");
		segGroup.setLayout(new GridLayout(4, false));
		segItem.setControl(segGroup);

		// Opened Image Label
		label = new Label(segGroup, SWT.NONE);
		fontData = new FontData(shell.getFont().getFontData()[0].getName(),
				shell.getFont().getFontData()[0].getHeight(), SWT.BOLD);
		label.setFont(new Font(shell.getDisplay(), fontData));
		gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
		label.setLayoutData(gridData);
		label.setText("Selected Image: ");

		openedImageText = new Text(segGroup, SWT.SINGLE | SWT.BORDER);
		openedImageText.setEnabled(false);
		gridData = new GridData(SWT.FILL, SWT.DEFAULT, true, false, 3, 1);
		openedImageText.setLayoutData(gridData);
		
		// Border-Button
		label = new Label(segGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
		label.setLayoutData(gridData);
		label.setText("Mark Border:");

		markBorderButton = new Button(segGroup, SWT.TOGGLE);
		gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
		markBorderButton.setLayoutData(gridData);
		markBorderButton.setBackground(Display.getCurrent()
				.getSystemColor(SWT.COLOR_GREEN));
		markBorderButton.setText("Border");

		// Pencilsize-Label
		label = new Label(segGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1);
		label.setLayoutData(gridData);
		label.setText("Pencil Size:");

		// ROI-Button
		label = new Label(segGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
		label.setLayoutData(gridData);
		label.setText("Region of Interest:");

		markROIButton = new Button(segGroup, SWT.TOGGLE);
		gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
		markROIButton.setLayoutData(gridData);
		markROIButton.setBackground(Display.getCurrent()
				.getSystemColor(SWT.COLOR_RED));
		markROIButton.setText("R O I");

		// Spinner for the Pencil-Size
		pencilSizeSpinner = new Spinner(segGroup, SWT.BORDER);
		gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
		pencilSizeSpinner.setLayoutData(gridData);


		// Neighborhood-Label
		label = new Label(segGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
		label.setLayoutData(gridData);
		label.setText("Neighborhood:");

		// Max Greyvalue-label
		label = new Label(segGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
		label.setLayoutData(gridData);
		label.setText("Max. Grayvalue:");

		// Neighborhood-Dropdown (Combo)
		neighborhoodCombo = new Combo(segGroup, SWT.DROP_DOWN);
		gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
		neighborhoodCombo.setLayoutData(gridData);

		// Max Greyvalue-Dropdown (Combo)
		maxGreyValueCombo = new Combo(segGroup, SWT.DROP_DOWN);
		gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
		maxGreyValueCombo.setLayoutData(gridData);

		// Distance Label
		label = new Label(segGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
		label.setLayoutData(gridData);
		label.setText("Distance");
		
		//Select Slices Checkbox (ButTon)
		selectSlicesButton = new Button(segGroup,SWT.CHECK);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false,2,1);
		selectSlicesButton.setLayoutData(gridData);
		selectSlicesButton.setText("Select Slices");

		// Distance-Dropdown (Combo)
		distanceCombo = new Combo(segGroup, SWT.DROP_DOWN);
		gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
		distanceCombo.setLayoutData(gridData);

		//Select Slices Spinner
		spinnerComp = new Composite(segGroup,SWT.NONE);
		gridData = new GridData(SWT.FILL, SWT.DEFAULT, true, false, 2, 1);
		spinnerComp.setLayoutData(gridData);
		layout = new GridLayout(3, false);
		layout.marginHeight = 0;
		layout.marginWidth = 0;
		spinnerComp.setLayout(layout);
		
		fromSpinner = new Spinner(spinnerComp,SWT.BORDER);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false);
		fromSpinner.setLayoutData(gridData);
		
		label = new Label(spinnerComp,SWT.NONE);
		gridData = new GridData(SWT.DEFAULT,SWT.CENTER,false,false);
		label.setLayoutData(gridData);
		label.setText("to");
		
		toSpinner= new Spinner(spinnerComp,SWT.BORDER);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false);
		toSpinner.setLayoutData(gridData);
		
		// Strength between Slices
		strengthLabel = new Label(segGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT, SWT.CENTER, true, false, 4, 1);
		strengthLabel.setLayoutData(gridData);
		strengthLabel.setText("Strength between slices: 100%");
		
		//Streng between Slices Scale
		strengthScale = new Scale(segGroup, SWT.NONE);
		gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1);
		strengthScale.setLayoutData(gridData);

		// Segmentation Quality
		label = new Label(segGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT, SWT.CENTER, true, false, 4, 1);
		label.setLayoutData(gridData);
		label.setText("Segmentation quality:");

		tmpComp = new Composite(segGroup, SWT.NONE);
		gridData = new GridData(SWT.FILL, SWT.DEFAULT, true, false, 4, 1);
		tmpComp.setLayoutData(gridData);
		layout = new GridLayout(3, false);
		layout.marginHeight = 0;
		layout.marginWidth = 0;
		tmpComp.setLayout(layout);

		label = new Label(tmpComp, SWT.NONE);
		gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
		label.setLayoutData(gridData);
		label.setText("Performance");

		performanceScale = new Scale(tmpComp, SWT.NONE);
		gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
		performanceScale.setLayoutData(gridData);

		label = new Label(tmpComp, SWT.NONE);
		gridData = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
		label.setLayoutData(gridData);
		label.setText("Quality");

		// Reset Button
		tmpComp = new Composite(segGroup, SWT.NONE);
		gridData = new GridData(SWT.FILL, SWT.DEFAULT, true, false, 4, 1);
		tmpComp.setLayoutData(gridData);
		layout = new GridLayout(3, false);
		layout.marginHeight = 0;
		layout.marginWidth = 0;
		tmpComp.setLayout(layout);

		resetButton = new Button(tmpComp, SWT.PUSH);
		gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
		resetButton.setLayoutData(gridData);
		resetButton.setText("Reset");

		// Segement Button
		segmentationButton = new Button(tmpComp, SWT.PUSH);
		gridData = new GridData(SWT.LEFT, SWT.CENTER, true, false);
		segmentationButton.setLayoutData(gridData);
		segmentationButton.setText("Start Segmentation");

		// Save Button
		saveButton = new Button(tmpComp, SWT.PUSH);
		gridData = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
		saveButton.setLayoutData(gridData);
		saveButton.setText("Save Binary Seq.");
		
		//Tooltip
		toolTip = new ToolTip(shell,SWT.BALLOON | SWT.ICON_WARNING);
		
		////////////////////////////////////////////////////////
		//////////////// Heart Group ///////////////////////////
		////////////////////////////////////////////////////////
		
		myocardiumGroup = new Group(tabFolder, SWT.SHADOW_IN);
		myocardiumGroup.setText("Myocardium");
		myocardiumGroup.setLayout(new GridLayout(4,false));
		heartItem.setControl(myocardiumGroup);
		
			//Opening & Closing Group
		openCloseGroup = new Group(myocardiumGroup, SWT.SHADOW_IN);
		openCloseGroup.setText("Alternating Sequential Filter (Opening && Closing)");
		gridData = new GridData(SWT.FILL,SWT.DEFAULT,true,false,4,1);
		openCloseGroup.setLayoutData(gridData);
		openCloseGroup.setLayout(new GridLayout(2,false));
		
		//Open-Close-RadioButton
		openCloseButton = new Button(openCloseGroup,SWT.RADIO);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false,2,1);
		openCloseButton.setLayoutData(gridData);
		openCloseButton.setText("Open-Close");

		//Close-Open-RadioButton
		closeOpenButton = new Button(openCloseGroup,SWT.RADIO);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false,2,1);
		closeOpenButton.setLayoutData(gridData);
		closeOpenButton.setText("Close-Open");
		
		//Structuring elements Label
		label = new Label(openCloseGroup,SWT.NONE);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false,2,1);
		label.setLayoutData(gridData);
		fontData = new FontData(shell.getFont().getFontData()[0].getName(),
				shell.getFont().getFontData()[0].getHeight(), SWT.BOLD);
		label.setFont(new Font(shell.getDisplay(), fontData));
		label.setText("Structuring Element(s)");
		
		//Strucutureelements Spinner
		asfSpinner = new Spinner(openCloseGroup,SWT.BORDER);
		gridData = new GridData(SWT.LEFT,SWT.CENTER,false,false);
		asfSpinner.setLayoutData(gridData);
		
			//asf label to display which structurelemets are to be used
		asfLabel = new Label(openCloseGroup,SWT.NONE);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false);
		asfLabel.setLayoutData(gridData);
		asfLabel.setText("3x3");
		
		//asf-start Button
		asfStartButton = new Button(openCloseGroup,SWT.PUSH);
		gridData = new GridData(SWT.DEFAULT,SWT.CENTER,false,false);
		asfStartButton.setLayoutData(gridData);
		asfStartButton.setText("Start");
		
		//////////////// Manual correction/////////////////////////////////////////////
		manualASFCorrectionGroup = new Group(myocardiumGroup, SWT.SHADOW_IN);
		manualASFCorrectionGroup.setText("Manual Correction of ASF Result");
		gridData = new GridData(SWT.FILL, SWT.DEFAULT,true,false,4,1);
		manualASFCorrectionGroup.setLayoutData(gridData);
		manualASFCorrectionGroup.setLayout(new GridLayout(2,false));
		
		manualASFCorrectAddButton = new Button(manualASFCorrectionGroup, SWT.RADIO);
		gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
		manualASFCorrectAddButton.setLayoutData(gridData);
		manualASFCorrectAddButton.setText("Add Voxels");
		
		manualASFCorrectDeleteButton = new Button(manualASFCorrectionGroup, SWT.RADIO);
		gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
		manualASFCorrectDeleteButton.setLayoutData(gridData);
		manualASFCorrectDeleteButton.setText("Delete Voxels");
		
		manualASFCorrectStartButton = new Button(manualASFCorrectionGroup, SWT.PUSH);
		gridData = new GridData(SWT.DEFAULT, SWT.CENTER, false, false);
		manualASFCorrectStartButton.setLayoutData(gridData);
		manualASFCorrectStartButton.setText("Start");
		
		//////////////// Rolling Ball /////////////////////////////////////
		
		rollingBallGroup = new Group(myocardiumGroup, SWT.SHADOW_IN);
		rollingBallGroup.setText("Rolling Ball");
		gridData = new GridData(SWT.FILL, SWT.DEFAULT,true,false,4,1);
		rollingBallGroup.setLayoutData(gridData);
		rollingBallGroup.setLayout(new GridLayout(4,false));
		
		//color One group (usually cyan)
		rollingBallColorOneGroup = new Group(rollingBallGroup, SWT.SHADOW_IN);
		rollingBallColorOneGroup.setText("Cyan Colored Bloodmass");
		rollingBallColorOneGroup.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));
		gridData = new GridData(SWT.FILL,SWT.DEFAULT,true,false,4,1);
		rollingBallColorOneGroup.setLayoutData(gridData);
		rollingBallColorOneGroup.setLayout(new GridLayout(3,false));
		
		label = new Label(rollingBallColorOneGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT,SWT.CENTER,false,false);
		label.setLayoutData(gridData);
		label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));
		label.setText("avg. Wall Thickness: ");
		
		avgColorOneSpinner = new Spinner(rollingBallColorOneGroup, SWT.BORDER);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false);
		avgColorOneSpinner.setLayoutData(gridData);
		avgColorOneSpinner.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));
		
		label = new Label(rollingBallColorOneGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT,SWT.CENTER,false,false);
		label.setLayoutData(gridData);
		label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));
		label.setText(" mm");
		
		label = new Label(rollingBallColorOneGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT,SWT.CENTER,false,false);
		label.setLayoutData(gridData);
		label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));
		label.setText("min. Wall Thickness: ");
		
		minColorOneSpinner = new Spinner(rollingBallColorOneGroup, SWT.BORDER);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false);
		minColorOneSpinner.setLayoutData(gridData);
		minColorOneSpinner.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));
		
		label = new Label(rollingBallColorOneGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT,SWT.CENTER,false,false);
		label.setLayoutData(gridData);
		label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));
		label.setText(" mm");
		
		label = new Label(rollingBallColorOneGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT,SWT.CENTER,false,false);
		label.setLayoutData(gridData);
		label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));
		label.setText("max. Wall Thickness: ");
		
		maxColorOneSpinner = new Spinner(rollingBallColorOneGroup, SWT.BORDER);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false);
		maxColorOneSpinner.setLayoutData(gridData);
		maxColorOneSpinner.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));
		
		label = new Label(rollingBallColorOneGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT,SWT.CENTER,false,false);
		label.setLayoutData(gridData);
		label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_CYAN));
		label.setText(" mm");
		
		
		//color Two group (usually cyan)
		rollingBallColorTwoGroup = new Group(rollingBallGroup, SWT.SHADOW_IN);
		rollingBallColorTwoGroup.setText("Magenta Colored Bloodmass");
		rollingBallColorTwoGroup.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_MAGENTA));
		gridData = new GridData(SWT.FILL,SWT.DEFAULT,true,false,4,1);
		rollingBallColorTwoGroup.setLayoutData(gridData);
		rollingBallColorTwoGroup.setLayout(new GridLayout(3,false));
		
		label = new Label(rollingBallColorTwoGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT,SWT.CENTER,false,false);
		label.setLayoutData(gridData);
		label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_MAGENTA));
		label.setText("avg. Wall Thickness: ");
		
		avgColorTwoSpinner = new Spinner(rollingBallColorTwoGroup, SWT.BORDER);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false);
		avgColorTwoSpinner.setLayoutData(gridData);
		avgColorTwoSpinner.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_MAGENTA));
		
		label = new Label(rollingBallColorTwoGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT,SWT.CENTER,false,false);
		label.setLayoutData(gridData);
		label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_MAGENTA));
		label.setText(" mm");
		
		label = new Label(rollingBallColorTwoGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT,SWT.CENTER,false,false);
		label.setLayoutData(gridData);
		label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_MAGENTA));
		label.setText("min. Wall Thickness: ");
		
		minColorTwoSpinner = new Spinner(rollingBallColorTwoGroup, SWT.BORDER);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false);
		minColorTwoSpinner.setLayoutData(gridData);
		minColorTwoSpinner.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_MAGENTA));
		
		label = new Label(rollingBallColorTwoGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT,SWT.CENTER,false,false);
		label.setLayoutData(gridData);
		label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_MAGENTA));
		label.setText(" mm");
		
		label = new Label(rollingBallColorTwoGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT,SWT.CENTER,false,false);
		label.setLayoutData(gridData);
		label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_MAGENTA));
		label.setText("max. Wall Thickness: ");
		
		maxColorTwoSpinner = new Spinner(rollingBallColorTwoGroup, SWT.BORDER);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false);
		maxColorTwoSpinner.setLayoutData(gridData);
		maxColorTwoSpinner.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_MAGENTA));
		
		label = new Label(rollingBallColorTwoGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT,SWT.CENTER,false,false);
		label.setLayoutData(gridData);
		label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_MAGENTA));
		label.setText(" mm");
		
		//Gray value Group
		rollingBallGrayValueRangeGroup = new Group(rollingBallGroup, SWT.SHADOW_IN);
		rollingBallGrayValueRangeGroup.setText("Grayvaluerange");
		gridData = new GridData(SWT.FILL,SWT.DEFAULT,true,false,4,1);
		rollingBallGrayValueRangeGroup.setLayoutData(gridData);
		rollingBallGrayValueRangeGroup.setLayout(new GridLayout(4,false));
		
		label = new Label(rollingBallGrayValueRangeGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT,SWT.CENTER,false,false);
		label.setLayoutData(gridData);
		label.setText("min: ");
		
		minGrayValueText = new Text(rollingBallGrayValueRangeGroup, SWT.SINGLE | SWT.BORDER);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false);
		minGrayValueText.setLayoutData(gridData);
		
		label = new Label(rollingBallGrayValueRangeGroup, SWT.NONE);
		gridData = new GridData(SWT.LEFT,SWT.CENTER,false,false);
		label.setLayoutData(gridData);
		label.setText(" - max: ");
		
		maxGrayValueText = new Text(rollingBallGrayValueRangeGroup, SWT.SINGLE | SWT.BORDER);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false);
		maxGrayValueText.setLayoutData(gridData);
		
		/////////////////////////////////////////
				
		rollingBallStartButton = new Button(rollingBallGroup, SWT.PUSH);
		gridData = new GridData(SWT.DEFAULT,SWT.CENTER,false,false);
		rollingBallStartButton.setLayoutData(gridData);
		rollingBallStartButton.setText("Start");
		
		rollingBallSaveButton = new Button(rollingBallGroup, SWT.PUSH);
		gridData = new GridData(SWT.DEFAULT, SWT.CENTER,false,false);
		rollingBallSaveButton.setLayoutData(gridData);
		rollingBallSaveButton.setText("Save");
		
		label = new Label(rollingBallGroup, SWT.NONE);
		gridData = new GridData(SWT.DEFAULT,SWT.CENTER,true,false);
		label.setLayoutData(gridData);
		label.setText("+/- Slices in z-direction: ");
		
		rollingBallZSliceSpinner = new Spinner(rollingBallGroup, SWT.BORDER);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false);
		rollingBallZSliceSpinner.setLayoutData(gridData);
				
		//Rolling Ball Correction
		manualrollingBallCorrectionGroup = new Group(myocardiumGroup, SWT.SHADOW_IN);
		manualrollingBallCorrectionGroup.setText("Manual Correction of Rolling Ball Result");
		gridData = new GridData(SWT.FILL, SWT.DEFAULT,true,false,4,1);
		manualrollingBallCorrectionGroup.setLayoutData(gridData);
		manualrollingBallCorrectionGroup.setLayout(new GridLayout(2,false));
		
		manualRollingBallCorrectAddButton = new Button(manualrollingBallCorrectionGroup, SWT.RADIO);
		gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
		manualRollingBallCorrectAddButton.setLayoutData(gridData);
		manualRollingBallCorrectAddButton.setText("Add Voxels");
		
		manualRollingBallCorrectDeleteButton = new Button(manualrollingBallCorrectionGroup, SWT.RADIO);
		gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
		manualRollingBallCorrectDeleteButton.setLayoutData(gridData);
		manualRollingBallCorrectDeleteButton.setText("Delete Voxels");
		
		manualRollingBallCorrectStartButton = new Button(manualrollingBallCorrectionGroup, SWT.PUSH);
		gridData = new GridData(SWT.DEFAULT, SWT.CENTER, false, false);
		manualRollingBallCorrectStartButton.setLayoutData(gridData);
		manualRollingBallCorrectStartButton.setText("Start");
		
		////////////////////////////////////////////////////////
		//////////////// Conductor Group ///////////////////////////
		////////////////////////////////////////////////////////
		conductorGroup = new Group(tabFolder, SWT.SHADOW_IN);
		conductorGroup.setText("Conductor Modell");
		conductorGroup.setLayout(new GridLayout(4, false));
		electricalItem.setControl(conductorGroup);
		
		//Load binary Image
		loadBinaryImageButton = new Button(conductorGroup, SWT.PUSH);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false,4,1);
		loadBinaryImageButton.setLayoutData(gridData);
		loadBinaryImageButton.setText("Load Overlay");
		
		conductorDrawAVNodeButton = new Button(conductorGroup, SWT.PUSH);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false,4,1);
		conductorDrawAVNodeButton.setLayoutData(gridData);
		conductorDrawAVNodeButton.setText("Draw AV Node");
		
		conductorStartDrawing = new Button(conductorGroup,SWT.PUSH);
		gridData = new GridData(SWT.FILL,SWT.CENTER,true,false,4,1);
		conductorStartDrawing.setLayoutData(gridData);
		conductorStartDrawing.setText("Start Creating Conductor System");
		
	}
}